﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GMusic
{
    public partial class MiniControls : Form
    {
        private MiniControls()
        {
            InitializeComponent();
        }

        private void btnPrevTrack_Click(object sender, EventArgs e)
        {
            Player.Instance.PrevTrack();
        }

        private void btnPlayPause_Click(object sender, EventArgs e)
        {
            Player.Instance.PlayPause();
        }

        private void btnNextTrack_Click(object sender, EventArgs e)
        {
            Player.Instance.NextTrack();
        }

        private void btnEnlarge_Click(object sender, EventArgs e)
        {
            Player.Instance.Show();
            Player.Instance.WindowState = GMusic.Properties.Settings.Default.FullPlayerState;
            this.Hide();
        }

        private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                NativeMethods.ReleaseCapture();
                NativeMethods.SendMessage(Handle, 
                    NativeMethods.WM_NCLBUTTONDOWN, NativeMethods.HT_CAPTION, 0);
            }
        }

        private void OnMouseEnter(object sender, EventArgs e)
        {
            this.Opacity = 1.00f;
        }

        private void OnMouseLeave(object sender, EventArgs e)
        {
            this.Opacity = 0.70f;
        }

        public static readonly MiniControls Instance = new MiniControls();

        private void MiniControls_Resize(object sender, EventArgs e)
        {
            if (this.Width != 190 || this.Height != 26)
                this.Size = new Size(190, 26);
        }
    }
}
